package com.njwt.cloud.msconsumer.controller;

import com.njwt.cloud.mscommon.pojo.OrderModel;
import com.njwt.cloud.msconsumer.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author <a href="mailto:xingxiao@gtmap.cn">xingxiaofeng</a>
 * @version2.1 2022-04-11
 * @description
 */
@RestController
public class COrederController {

    @Resource
    private OrderService orderService;


    /***
     * 普通方式传递单个参数：get方式
     */
    @GetMapping("/params")
    public String doParams01(@RequestParam("params") String params) {

        return orderService.doParams01(params);
    }

    /***
     * 普通方式传递单个参数：post方式
     */
    @PostMapping("/params")
    public String doParams02(@RequestParam("params") String params) {

        return orderService.doParams02(params);
    }

    /***
     * rest风格传递单个参数：get方式
     */
    @GetMapping("/params/{params}")
    public String doParams03(@PathVariable("params") String params) {

        return orderService.doParams03(params);
    }
    /***
     * rest风格传递单个参数：post方式
     */
    @PostMapping("/params/{params}")
    public String doParams04(@PathVariable("params") String params) {

        return orderService.doParams04(params);
    }

    @GetMapping("/getOrder")
    public OrderModel getOrder(){
            return orderService.getOrder();
    }
    @GetMapping("/getOrderById")
    public OrderModel getOrderById(@RequestParam("orderid") String orderid){
        return orderService.getOrderById(orderid);
    }
    @GetMapping("/getOrderList")
    public List<OrderModel> getOrderList( @RequestBody OrderModel orderModel){
        return orderService.getOrderList(orderModel);
    }

}
